<div class="blog_detail">
	<div class="article">
		<?php if(!$article){?>
		<div>您访问的文章不存在或已经被删除</div>
		<?php }else{?>
    	<div class="title">
    		<div class="name"><?=$article['article_title']?></div>
    		<div class="info">
        		<!-- <span><?php //Web_Model_Common::getFormatTime($article['article_time']);?></span>
        		<span><a href="http://<?=HOST?>/blog/list/pid/<?=$article['article_main_class_id']?>" target="_blank"><?=$article['article_main_class_name']?></a>-><a href="http://<?=HOST?>/blog/list/cid/<?=$article['article_sub_class_id']?>" target="_blank"><?=$article['article_sub_class_name']?></a></span>
        		<span>作者:<?=$article['article_author_name']?></span> -->
        		<?php if (Web_Model_Auth::hasRightUpdateArticle($article['article_author_id'])){?>
        		<span><a href="http://<?=HOST?>/blog/edit/id/<?=$article['article_id']?>">编辑</a></span>
        		<span id="delete_btn" class="delete_btn">删除</span>
        		<span><a href="http://<?=HOST?>/blog/download/id/<?=$article['article_id']?>">下载</a></span>
        		<script type="text/javascript">
                    $("#delete_btn").click(function(){
                    	if(!confirm("确定删除？")) return;
                        $.ajax({
                    		   url: "http://<?=HOST?>/blog/deleteAjax",
                    		   cache: false,
                    		   timeout:10000,
                    		   type: "POST",
                    		   data: {
                    			article_id:<?=$article['article_id']?>
                    		  },
                    		  dataType: "json",
                    		  beforeSend: function() {
                				  disableHTML(true, '请稍等，删除中……', true);
                			  },
                    		  success: function(data) {
                        		  if(data.errCode == 0)
                        		  {
                        			disableHTML(true, '删除成功，跳转中……', true);
                        			setTimeout("location.href = 'http://<?=HOST?>/blog/'",2000);
                        		  }
                        		  else
                        		  {
                        			  disableHTML(true, data.errMsg, false);
                       			      setTimeout(disableHTML,2000);
                        		  }
                    		  },
                    		  error:function(){
                        			disableHTML(true, "请求出错，请重试", false);
                        			setTimeout(disableHTML,2000);
                        	  }
                    		});
                	});
                </script>
        		<?php }?>
			</div>
    	</div>
    	<div class="content html"><?=$article['article_content']?></div>
    	<br>
    	<!-- <div>(转载请注明*** 作者:<?=$article['article_author_name']?>, 出处:http://<?=HOST?>/blog/detail/id/<?=$article['article_id']?> ***)</div> -->
    	<?php }?>
	</div>
	<?php if($article){?>
	<?php if($lastArticle || $nextArticle){?>
	<div class="like">
		<div class="last">
			<?php if($lastArticle){?>
			<a href="http://<?=HOST?>/blog/detail/id/<?=$lastArticle['article_id']?>">
				上篇文章:<?=$lastArticle['article_title']?>
			</a>
			<?php }?>
		</div>
		<div class="next">
			<?php if($nextArticle){?>
			<a href="http://<?=HOST?>/blog/detail/id/<?=$nextArticle['article_id']?>">
				下篇文章:<?=$nextArticle['article_title']?>
			</a>
			<?php }?>
		</div>
	</div>
	<?php }?>
	<div class="comment">
		<div class="title">网友评论:</div>
		<?php $i = 1;foreach ($comment as $eachComment){?>
		<div class="comment_list">
			<div class="info">
				<span class="floor"><?=$i?>楼</span>
				<span><?=Web_Model_Common::getFormatTime($eachComment['comment_time']);?></span>
				<span><?=$eachComment['comment_member_nickname']?></span>
				<?php if(Web_Model_Member::isSignIn()){?>
				<span class="btn" onclick="reply('<?=$eachComment['comment_member_nickname']?>')")>回复</span>
				<?php }?>
				<?php if(Web_Model_Auth::hasRightSetting()){?>
				<span class="btn" onclick="delete_comment(<?=$eachComment['comment_id']?>)")>删除</span>
				<?php }?>
			</div>
			<div class="content html">
				<?=$eachComment['comment_content']?>
			</div>
		</div>
		<?php $i++;} ?>
		<div class="write_comment">
			<div class="info">
				<?php if(Web_Model_Member::isSignIn()){?>
				<span class="name"><?=Web_Model_Member::getNickName()?></span>，欢迎您发表评论
				<?php }else{?>
				登录后可以发表评论
				<?php } ?>
		    </div>
			<div class="content text edit" id="comment_write_conent"></div>
			<?php if(Web_Model_Member::isSignIn()){?>
			<div class="func">
				<input type="button" id="public_btn" class="btn btn_input" value="发表评论" />
				<input type="text" id="code" class="code text" value="" />
				<img class="code_img" id="code_img" src="http://<?=HOST?>/auth/code/<?=time()?>" />
			</div>
			<script src="<?=STATIC_PATH?>Js/nicedit/nicEdit.js" type="text/javascript"></script>
			<script type="text/javascript">
                myEditor = new nicEditor({fullPanel : true});
                myEditor.addInstance('comment_write_conent');
                myEditor = myEditor.instanceById('comment_write_conent');
                myEditor.setContent("");
                function reply(i)
                {
                	myEditor.setContent("回复<strong>"+i+"</strong>：");
                	window.scrollTo(0,document.body.scrollHeight);
                }
                $("#public_btn").click(function (){
                	$.ajax({
              		  url: "http://<?=HOST?>/blog/addCommentAjax",
              		  cache: false,
              		  timeout:10000,
              		  type: "POST",
              		  data: {
              			article_id:<?=$article['article_id']?>,
              			content:myEditor.getContent(),
              			code:$("#code").val()
              		  },
              		  dataType: "json",
              		  beforeSend: function() {
          				  disableHTML(true, '请稍等，提交中……', true);
          			  },
              		  success: function(data) {
                  		  if(data.errCode == 0){
                  			  disableHTML(true, '提交成功，跳转中……', true);
                  			  setTimeout("location.reload()",2000);
                  		  }else{
                  			    disableHTML(true, data.errMsg, false);
                  			    setTimeout(disableHTML,2000);
                  				changeAuthCode("code_img");
                  			    $("#comment_write_conent").focus();
                  		  }
              		  },
              		error:function(){
              			disableHTML(true, "请求出错，请重试", false);
              			setTimeout(disableHTML,2000);
              		}
              		});
                });
                <?php if(Web_Model_Auth::hasRightSetting()){?>
                function delete_comment (id){
                	if(!confirm("确定删除？")) return;
                	$.ajax({
              		  url: "http://<?=HOST?>/blog/delCommentAjax",
              		  cache: false,
              		  timeout:10000,
              		  type: "POST",
              		  data: {
              			comment_id:id,
              		  },
              		  dataType: "json",
              		  beforeSend: function() {
          				  disableHTML(true, '请稍等，删除中……', true);
          			  },
              		  success: function(data) {
                  		  if(data.errCode == 0){
                  			  disableHTML(true, '删除成功，跳转中……', true);
                  			  setTimeout("location.reload()",2000);
                  		  }
                  		  else
                  		  {
                  			  disableHTML(true, data.errMsg, false);
              			      setTimeout(disableHTML,2000);
                  		  }
              		  },
              		  error:function(){
              			  disableHTML(true, "请求出错，请重试", false);
              			  setTimeout(disableHTML,2000);
              		  }
              		});
                };
				<?php }?>
            </script>
		    <?php } ?>
		</div>
	</div>
	<?php }?>
</div>